import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        user: null
    },
    mutations: {
        SET_USER (state, user) {
            state.user = user;
            window.sessionStorage.setItem('user', user);
        },
        CLEAR_LOGIN (state, user) {
            state.user = null;
            window.sessionStorage.removeItem('user');
            window.sessionStorage.removeItem('token');
        }
    },
    actions: {},
    modules: {}
})